perm filename REG.DOC[S1,ALS] blob sn#413748 filedate 1979-01-30 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	Register conventions in S1 to be implemented
C00006 ENDMK
CāŠ—;
Register conventions in S1 to be implemented


1) Allow only fixed number of Lexical levels
2) Lexical level # set by a constant MAXLVL (here ML) (probably 6 at the start)
3) Register assignments
 	R[0..11]	Temporary	Saved and Restored by caller
					Can be used by Callee without restoring  
	R[4..11]			Actual parameters passed (loaded by caller)
					Function Results returned by Callee
	R[12..11+LP]	Parameters	Loaded by Caller and returned by Callee
					Those not used to return data may be altered
					by Callee without restoring
					The value of LP is known to both, and
					cannot exceed 18-ML.
	R[12+LP..29-ML]	Local registers Must be saved by Callee if used
					If ML is 6 then upper limit is 23
	R[30-ML..29]	FramePointers	Set by Caller so Callee can reference Caller

The normal case might be for there to be not more than 8 registers needed to
pass parameters in which case the temporary registers would suffice and if ML=6
there would be 19 registers which the callee would have to restore if used.
If the caller did not use all of these registers then the callee might be
restoring unused registers.


If Callee is not to become a Caller then it should try use TemporaryRegesters
and ParapeterRegisters for as many variables as possible before using Locals.
If Callee is to become a Caller then it should distribute its variables between
Temporaries and Locals in such a way as the minimize the number of times
that a register will have to be saved either by it or by its Callee.

CURRENT PARAMETERS

MINPARS1REG = 8;        	(*smallest numbered parameter register*)
MAXDSPS1REG = 29;       	(*largest numbered display register*)
MAXPAREG = 10;   		(*Maximum number of parameter registers*)
MAXPAREGM1 = 9;  		(*Maximum logical index of a parameter reg*)
MAXLVL = 8;      		(*Maximum nesting of procedure declarations*)

R[0..